<template>
  <a-drawer
    width="576"
    :title="formTitle"
    :label-col="4"
    :wrapper-col="14"
    :visible="open"
    :body-style="{height:'calc(100vh - 100px)',overflow:'auto'}"
    @close="cancel">
    <a-form-model ref="form" :model="form" :rules="rules" layout="vertical">
      <a-spin :spinning="spinning" :delay="delayTime" tip="Loading...">
        <a-row :gutter="32">
          <a-col :span="12">
            <a-form-model-item label="主机名" prop="hostName">
              <a-input v-model="form.hostName" placeholder="请输入主机名"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="主机IP" prop="hostIp">
              <a-input v-model="form.hostIp" placeholder="请输入主机IP"/>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="32">
          <a-col :span="12">
            <a-form-model-item label="主机端口" prop="hostPort">
              <a-input v-model="form.hostPort" placeholder="请输入主机端口"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="主机账号" prop="account">
              <a-input v-model="form.account" placeholder="请输入主机账号"/>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="32">
          <a-col :span="12">
            <a-form-model-item label="主机密码" prop="password">
              <a-input-password placeholder="请输入主机密码" v-model="form.password" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12" >
            <a-form-model-item label="类型" prop="type">
              <a-select
                placeholder="请选择类型"
                v-model="form.type"
                :getPopupContainer="
                  triggerNode => {
                    return triggerNode.parentNode || document.body
                  }
                "
                style="width: 100%"
                allow-clear>
                <a-select-option v-for="(d, index) in typeOptions" :key="index" :value="d.dictValue">{{ d.dictLabel }}</a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="32">
          <a-col :span="12" >
            <a-form-model-item label="状态" prop="status">
              <a-radio-group v-model="form.status">
                <a-radio
                  v-for="(dict, index) in statusOptions"
                  :key="index"
                  :value="dict.dictValue"
                >
                  {{ dict.dictLabel }}
                </a-radio>
              </a-radio-group>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="备注" prop="remark">
              <a-textarea v-model="form.remark" placeholder="请输入备注" :rows="4"/>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="32">
        </a-row>
      </a-spin>
      <div class="bottom-control">
        <a-space>
          <a-button :disabled="disabled" @click="cancel">
            取消
          </a-button>
          <a-button type="primary" :disabled="disabled" @click="submitForm(true)">
            保存
          </a-button>
        </a-space>
      </div>
    </a-form-model>
  </a-drawer>
</template>
<script>
import HostEditForm from './HostForm'
export default {
  ...HostEditForm
}
</script>
